package com.demo.spring.test.service;

import java.util.HashMap;
import java.util.Map;

public class UserDao {

    private static Map<String, String> hashMap = new HashMap<>();

    public void initDataMethod() {
        System.out.println("执行：init-method");
        hashMap.put("1001", "张三");
        hashMap.put("1002", "李四");
        hashMap.put("1003", "王五");
    }

    public void destroyDataMethod() {
        System.out.println("执行：destroy-method");
        hashMap.clear();
    }

    public String queryUserNames(String id) {
        return hashMap.get(id);
    }
}
